## regression ordinal result trends

reg_ord_trend <- function(data_temp = data.frame()){
  require(ggplot2)
  x_vec <- 1:dim(data_temp)[1]
  up_vec <- data_temp[,1] + 1.96 * data_temp[,2]
  low_vec <- data_temp[,1] - 1.96 * data_temp[,2]
  
  plot_df <- data.frame(rep(x_vec, 3), c(data_temp[,1], up_vec, low_vec),
                        c(rep("estimated_value", dim(data_temp)[1]),
                          rep("upper_bound", dim(data_temp)[1]),
                          rep("lower_bound", dim(data_temp)[1])))
  names(plot_df) <- c("categories", "value", "type")
  return(
    ggplot(plot_df, aes(x = categories, y = value, linetype = type)) + geom_line()
  )
}

